 		 function nameFocus() { //name获取焦点时
            var nameError = document.getElementById("nameError");
            var name = document.getElementById("name");
            if(name.value == ""){	
              nameError.innerHTML = "<span style='font-size:3px; color:red;'>请输入用户名</span>"
            }else{
            	namekeyup();
            }
          }
          function namekeyup() {  //onkeyup事件会在键盘按键被松开时发生
            var name = document.getElementById("name");
            var nameError = document.getElementById("nameError");
            var reg= /^[A-Za-z0-9]+$/;
            if(name.value == ""){
              nameError.innerHTML = "<span style='font-size:3px; color:red;'>用户名不能为空</span>";
            }
            else if(reg.test(name.value) == false){
              nameError.innerHTML = "<span style='font-size:3px; color:red;'>用户名输入格式错误</span>";
            }
            else {
              nameError.innerHTML = "<span style='font-size:3px; color:green;'>用户名输入正确</span>";
            }
          } 
          function nameBlur() {  //失去焦点时
            var name = document.getElementById("name");
            var error = document.getElementById("nameError");
            var reg= /^[A-Za-z0-9]+$/;
            if(reg.test(name.value)==true) {
              error.innerHTML = "&nbsp;";            
              return true;
            }
            return false;
          }

          //密码验证
          function passwordFocus() { //name获取焦点时
            var passwordError = document.getElementById("passwordError");
            var password = document.getElementById("password");
            if(password.value == ""){	
              passwordError.innerHTML = "<span style='font-size:3px; color:red;'>请输入密码</span>"
            }else{
            	passwordkeyup();
            }
          }
          function passwordkeyup() {  //onkeyup事件会在键盘按键被松开时发生
            var password = document.getElementById("password");
            var passwordError = document.getElementById("passwordError");
            var reg= /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{4,16}$/;
            if(password.value == ""){
              passwordError.innerHTML = "<span style='font-size:3px; color:red;'>密码不能为空</span>";
            }
            else if(reg.test(password.value) == false){
              passwordError.innerHTML = "<span style='font-size:3px; color:red;'>密码格式有误</span>";
            }
            else {
              passwordError.innerHTML = "<span style='font-size:3px; color:green;'>密码格式输入正确</span>";
            }
          } 
          function passwordBlur() {  //失去焦点时
            var password = document.getElementById("password");
            var passwordError = document.getElementById("passwordError");
            var reg= /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{4,16}$/;
            if(reg.test(password.value)==true) {
              passwordError.innerHTML = "&nbsp;";
              return true;
            }
            return false;
          }
	       function checkForm() {
	    	 var flagusername = nameBlur();
	    	 var flagpassword = passwordBlur();
	    	 if(flagusername == true &&  flagpassword == true){
	        	return true;
	    	 }else{
	        	alert("提交失败，请按表单中红色提示输入信息！")
	        	return false;
	    	}
		   }
	       